#include <cstdio>

int n, v[ 21 ], sum;

void init( )
{
    int i;
    scanf("%d", &n);
    sum = 0;
    for ( i = 0; i < n; i++ )
    {
        scanf("%d", &v[ i ]);
        sum += v[ i ];
    }
}

void work( )
{
    int i, j, k, f[ sum / 2 ], count;
    for ( i = 0; i < n; i++ )
    {
        for ( j = 0; j <= sum / 2; j++ )
            f[ j ] = 0;
        f[ 0 ] = 1;
        for ( j = 0; j < n; j++ )
        {
            if ( j == i )
                continue;
            for ( k = sum / 2; k >= v[ j ]; k-- )
                f[ k ] += f[ k - v[ j ] ];
        }
        count = 0;
        for ( j = sum / 2; j >= sum / 2 - v[ i ] + 1 && j >= 0; j-- )
            count += f[ j ];
        if ( i )
            printf(" ");
        printf("%d", count);
    }
    printf("\n");
}

int main( )
{
    int t;
    scanf("%d", &t);
    while ( t-- )
    {
        init( );
        work( );
    }
    return 0;
}
